﻿using System.ComponentModel.Composition;
using Cubicle.Core.Interfaces;
using Cubicle.Core.Processors;
using Cubicle.Excel.Shared;

namespace Cubicle.Excel.Processors
{
    [Export("Cubicle.Excel.Processors.MarshalJaggedArray", typeof(IProcessor<object>))]
    [ExportMetadata("Name", "MarshalJaggedArray")]
    [ExportMetadata("Description", "Convert object[][] into object[,]")]
    public class MarshalJaggedArray : ConditionalProcessor<object>
    {

        public override bool Condition(object request)
        {
            return ExcelHelpers.IsJagged(request);
        }

        public override object ConditionalProcess(object request)
        {
            return ExcelHelpers.JaggedToDouble(request);
        }

    }
}